package com.pengshun.modules.api.mapper;

import com.pengshun.modules.api.petrol.service.dto.*;
import com.pengshun.modules.domain.JyPetrolStationActivity;
import com.pengshun.modules.domain.JyPetrolStationGun;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

/**
 * @author luoligang
 * @create 2021/6/28
 */
public interface PetrolStationMapper {


    List<JyPetrolStationProductListDto> selectList(@Param("page") Integer page, @Param("size") Integer size, @Param("name") String name, @Param("brandId") Integer brandId, @Param("distance") Integer distance, @Param("latitude") Double latitude, @Param("longitude") Double longitude, @Param("sort") Integer sort, @Param("stationId") Integer stationId);


    JyPetrolStationProductDetilDto selectDetilBy(@Param("petrolStationProductId") Long petrolStationProductId, @Param("longitude") Double longitude, @Param("latitude") Double latitude);

    List<JyPetrolStationConditionDto> selectConditionList();

    @Select("SELECT  c.`category_id`,c.`category_name` FROM  " +
            "`ps_category`  c WHERE c.`parent_id` =(SELECT pc.`category_id` FROM  `ps_category` pc  WHERE  pc.`code`='petrol_station_brand')")
    List<JyPetrolStationConditionDto> selectConditionNextList();

    List<JyPetrolStationTypeDto> selectType(@Param("petrolStationId") Long petrolStationId);

    @Select("select * from jy_petrol_station_gun where petrol_station_product_id=#{petrolStationProductId} and `status`=1")
    List<JyPetrolStationGun> selectGuns(@Param("petrolStationProductId") Long petrolStationProductId);

    List<JyPetrolStationOrderDto> selectOrderList(@Param("page") Integer page, @Param("size") Integer size, @Param("userId") Long userId);

    List<JyPetrolStationActivity> activityList(@Param("petrolStationProductId") Long petrolStationProductId);

    List<JyPetrolStationActivity> selectNowActivity(@Param("petrolStationProductId") Long petrolStationProductId);

    @Select("select petrol_station_id from  jy_petrol_station_employee where user_id=#{userId}")
    Long selectPetrolStationId(@Param("userId") Long userId);

    List<JyPetrolStationOrderDto> merchantOrderList(@Param("page") Integer page, @Param("size") Integer size, @Param("petrolStationId") Long petrolStationId, @Param("updateBy") String updateBy, @Param("carOwnerNum") String carOwnerNum,@Param("startDate") Date startDate, @Param("endDate") Date endDate);

    @Select("select employee_name from  jy_petrol_station_employee where user_id=#{userId}")
    String selectPetrolStationEmpName(Long userId);
}
